package com.xjnt.base.support.admin.service;

import com.jfinal.kit.HashKit;
import com.jfinal.plugin.activerecord.Db;
import com.xjnt.base.support.admin.entity.Account;
import com.xjnt.base.support.admin.entity.Dictionary;
import com.xjnt.base.support.admin.entity.Function;
import com.xjnt.base.support.admin.entity.Group;
import com.xjnt.base.support.admin.entity.Menu;
import com.xjnt.base.support.admin.entity.Org;
import com.xjnt.base.support.admin.entity.Permission;
import com.xjnt.base.support.admin.entity.Platform;
import com.xjnt.base.support.admin.entity.Role;
import com.xjnt.base.support.admin.entity.User;
import com.xjnt.frameworks.annotation.Service;
import com.xjnt.frameworks.core.BaseService;

@Service
public class InitialService extends BaseService<Account>{

	@Override
	public Account getModel() {
		return Account.me;
	}
	
	public String initOrg(){
		Db.update("delete from sys_account");
		Db.update("delete from sys_org");
		Org xjntOrg = new Org();
		xjntOrg.set(Org.NAME, "新疆广电网络股份有限公司");
		xjntOrg.set(Org.CODE, "1000");
		xjntOrg.set(Org.LEVEL, 0); // 根级组织
		xjntOrg.save();
		
		Org beiyanOrg = new Org();
		beiyanOrg.set(Org.NAME, "大北研");
		beiyanOrg.set(Org.CODE, "1001");
		beiyanOrg.set(Org.LEVEL, 1); 
		beiyanOrg.set(Org.FK_PID, xjntOrg.getStr(Org.PK_ID));
		beiyanOrg.save();
		
		Org devOrg = new Org();
		devOrg.set(Org.NAME, "研发部");
		devOrg.set(Org.CODE, "100101");
		devOrg.set(Org.LEVEL,  2); 
		devOrg.set(Org.FK_PID, beiyanOrg.getStr(Org.PK_ID));
		devOrg.save();
		return xjntOrg.getStr(Org.PK_ID);
	}
	
	public void initAccount(String orgId){
		Account account = Account.me.findFirst("select * from sys_account where username = ?", "admin");
		if(null == account){
			User user = new User();
			user.save();
			account = new Account();
			account.set(Account.USERNAME, "admin");
			account.set(Account.PASSWORD, HashKit.md5("123456"));
			account.set(Account.SUPER, 1);
			account.set(Account.LOCKED, 0);
			account.set(Account.FK_USERID, user.getStr(User.PK_ID));
			account.set(Account.FK_ORGID, orgId);
			account.save();
		} else {
			account.set(Account.PASSWORD, HashKit.md5("123456"));
			account.update();
		}
	}
	
	public void initDictionary(){
		Db.update("delete from sys_dictionary");
		
		Dictionary dictSex = new Dictionary();
		dictSex.set(Dictionary.NAME, "性别类型");
		dictSex.set(Dictionary.CODE, "CM-SEX");
		dictSex.set(Dictionary.TYPE, 0); //目录
		dictSex.save();
		
		Dictionary dictWoman = new Dictionary();
		dictWoman.set(Dictionary.NAME, "女");
		dictWoman.set(Dictionary.VALUE, "0");
		dictWoman.set(Dictionary.TYPE, 1);
		dictWoman.set(Dictionary.FK_PID, dictSex.getStr(Dictionary.PK_ID));
		dictWoman.save();
		
		Dictionary dictMan = new Dictionary();
		dictMan.set(Dictionary.NAME, "男");
		dictMan.set(Dictionary.VALUE, "1");
		dictMan.set(Dictionary.TYPE, 1);
		dictMan.set(Dictionary.FK_PID, dictSex.getStr(Dictionary.PK_ID));
		dictMan.save();
		
		Dictionary dictST = new Dictionary();
		dictST.set(Dictionary.NAME, "启停状态");
		dictST.set(Dictionary.CODE, "ST-STATUS");
		dictST.set(Dictionary.TYPE, 0); //目录
		dictST.save();
		
		Dictionary dictAct = new Dictionary();
		dictAct.set(Dictionary.NAME, "启用");
		dictAct.set(Dictionary.VALUE, "1");
		dictAct.set(Dictionary.TYPE, 1); //键值
		dictAct.set(Dictionary.FK_PID, dictST.getStr(Dictionary.PK_ID));
		dictAct.save();
		
		Dictionary dictUNAct = new Dictionary();
		dictUNAct.set(Dictionary.NAME, "停用");
		dictUNAct.set(Dictionary.VALUE, "0");
		dictUNAct.set(Dictionary.TYPE, 1); //键值
		dictUNAct.set(Dictionary.FK_PID, dictST.getStr(Dictionary.PK_ID));
		dictUNAct.save();
		//LINK-TYPES
		Dictionary dictLink = new Dictionary();
		dictLink.set(Dictionary.NAME, "链接类型");
		dictLink.set(Dictionary.CODE, "LINK-TYPES");
		dictLink.set(Dictionary.TYPE, 0); //目录
		dictLink.save();
		
		Dictionary dictAction = new Dictionary();
		dictAction.set(Dictionary.NAME, "Url");
		dictAction.set(Dictionary.VALUE, "URL");
		dictAction.set(Dictionary.TYPE, 1); //键值
		dictAction.set(Dictionary.FK_PID, dictLink.getStr(Dictionary.PK_ID));
		dictAction.save();
		
		Dictionary dictJS = new Dictionary();
		dictJS.set(Dictionary.NAME, "JavaScript");
		dictJS.set(Dictionary.VALUE, "JS");
		dictJS.set(Dictionary.TYPE, 1); //键值
		dictJS.set(Dictionary.FK_PID, dictLink.getStr(Dictionary.PK_ID));
		dictJS.save();
	}
	
	public void initResource(String orgId, String accountId) {
		Db.update("delete from sys_permission_function");
		Db.update("delete from sys_function");
		Db.update("delete from sys_permission_menu");
		Db.update("delete from sys_permission_platform");
		Db.update("delete from sys_function");
		Db.update("delete from sys_menu where type = 1");
		Db.update("delete from sys_menu where type = 0");
		Db.update("delete from sys_platform");
		Db.update("delete from sys_role_permission");
		Db.update("delete from sys_group_role");
		Db.update("delete from sys_group_account");
		Db.update("delete from sys_permission");
		Db.update("delete from sys_role");
		Db.update("delete from sys_group");
		/*
		 * ××××××××××××××××××××××××××××××××××× 
		 * × 基础资源数据建立 ×
		 * ×××××××××××××××××××××××××××××××××××
		 */

		Platform basePlatform = new Platform();
		basePlatform.set(Platform.NAME, "基础系统");
		basePlatform.set(Platform.ORDER, "01");
		basePlatform.set(Platform.REMARK, "系统的基本配置,如:账号.角色.权限.资源...");
		basePlatform.save();

		Menu moduleSys = new Menu();
		moduleSys.set(Menu.NAME, "基础管理");
		moduleSys.set(Menu.ORDER, "01");
		moduleSys.set(Menu.TYPE, 0);
		moduleSys.set(Menu.FK_PLATFORMID, basePlatform.getStr(Platform.PK_ID));
		moduleSys.save();

		Menu menuParam = new Menu();
		menuParam.set(Menu.NAME, "参数管理");
		menuParam.set(Menu.ORDER, "01");
		menuParam.set(Menu.URL, "/system/admin/param");
		menuParam.set(Menu.TYPE, 1);
		menuParam.set(Menu.FK_PID, moduleSys.getStr(Menu.PK_ID));
		menuParam.save();
		
		//mengde-param
		Function paramAdd = new Function();
		paramAdd.set(Function.NAME, "新增");
		paramAdd.set(Function.ELEM_ID, "addParam");
		paramAdd.set(Function.ELEM_TYPE, "button");
		paramAdd.set(Function.ELEM_STYLE, "btn btn-info btn-sm no-border");
		paramAdd.set(Function.ELEM_ICON, "ace-icon fa fa-plus bigger-110");
		paramAdd.set(Function.ACT_EVT, "onclick");
		paramAdd.set(Function.ACT_URL, "goAdd('新增参数', 'system/admin/param/add', 'table-param');");
		paramAdd.set(Function.FK_MENUID, menuParam.getStr(Menu.PK_ID));
		paramAdd.set(Function.ORDER, "01");		
		paramAdd.save();
				
		Function paramEdit = new Function();
		paramEdit.set(Function.NAME, "编辑");
		paramEdit.set(Function.ELEM_ID, "editParam");
		paramEdit.set(Function.ELEM_TYPE, "button");
		paramEdit.set(Function.ELEM_STYLE, "btn btn-success btn-sm no-border");
		paramEdit.set(Function.ELEM_ICON, "ace-icon fa fa-pencil-square-o bigger-110");
		paramEdit.set(Function.ACT_EVT, "onclick");
		paramEdit.set(Function.ACT_URL, "goUpdate('编辑参数', 'system/admin/param/edit', 'table-param');");
		paramEdit.set(Function.FK_MENUID, menuParam.getStr(Menu.PK_ID));
		paramEdit.set(Function.ORDER, "02");
		paramEdit.save();
				
		Function paramDel = new Function();
		paramDel.set(Function.NAME, "删除");
		paramDel.set(Function.ELEM_ID, "delParam");
		paramDel.set(Function.ELEM_TYPE, "button");
		paramDel.set(Function.ELEM_STYLE, "btn btn-danger btn-sm no-border");
		paramDel.set(Function.ELEM_ICON, "ace-icon fa fa-trash-o bigger-110");
		paramDel.set(Function.ACT_EVT, "onclick");
		paramDel.set(Function.ACT_URL, "doDels('system/admin/param/deletes', 'table-param');");
		paramDel.set(Function.FK_MENUID, menuParam.getStr(Menu.PK_ID));
		paramDel.set(Function.ORDER, "03");
		paramDel.save();
								
		Menu menuDictionary = new Menu();
		menuDictionary.set(Menu.NAME, "字典管理");
		menuDictionary.set(Menu.ORDER, "02");
		menuDictionary.set(Menu.URL, "/system/admin/dictionary");
		menuDictionary.set(Menu.TYPE, 1);
		menuDictionary.set(Menu.FK_PID, moduleSys.getStr(Menu.PK_ID));
		menuDictionary.save();
		
		//mengde-Dictionary
		Function dictionaryAdd = new Function();
		dictionaryAdd.set(Function.NAME, "新增");
		dictionaryAdd.set(Function.ELEM_ID, "addDictionary");
		dictionaryAdd.set(Function.ELEM_TYPE, "button");
		dictionaryAdd.set(Function.ELEM_STYLE, "btn btn-info btn-sm no-border");
		dictionaryAdd.set(Function.ELEM_ICON, "ace-icon fa fa-plus bigger-110");
		dictionaryAdd.set(Function.ACT_EVT, "onclick");
		dictionaryAdd.set(Function.ACT_URL, "goAdd('新增目录', 'system/admin/dictionary/add?type=0', 'table-catalog');");
		dictionaryAdd.set(Function.FK_MENUID, menuDictionary.getStr(Menu.PK_ID));
		dictionaryAdd.set(Function.ORDER, "01");		
		dictionaryAdd.save();
				
		Function dictionaryEdit = new Function();
		dictionaryEdit.set(Function.NAME, "编辑");
		dictionaryEdit.set(Function.ELEM_ID, "editDictionary");
		dictionaryEdit.set(Function.ELEM_TYPE, "button");
		dictionaryEdit.set(Function.ELEM_STYLE, "btn btn-success btn-sm no-border");
		dictionaryEdit.set(Function.ELEM_ICON, "ace-icon fa fa-pencil-square-o bigger-110");
		dictionaryEdit.set(Function.ACT_EVT, "onclick");
		dictionaryEdit.set(Function.ACT_URL, "goUpdate('编辑目录', 'system/admin/dictionary/edit', 'table-catalog');");
		dictionaryEdit.set(Function.FK_MENUID, menuDictionary.getStr(Menu.PK_ID));
		dictionaryEdit.set(Function.ORDER, "02");
		dictionaryEdit.save();
				
		Function dictionaryDel = new Function();
		dictionaryDel.set(Function.NAME, "删除");
		dictionaryDel.set(Function.ELEM_ID, "delDictionary");
		dictionaryDel.set(Function.ELEM_TYPE, "button");
		dictionaryDel.set(Function.ELEM_STYLE, "btn btn-danger btn-sm no-border");
		dictionaryDel.set(Function.ELEM_ICON, "ace-icon fa fa-trash-o bigger-110");
		dictionaryDel.set(Function.ACT_EVT, "onclick");
		dictionaryDel.set(Function.ACT_URL, "doDels('system/admin/dictionary/deletes', 'table-catalog');");
		dictionaryDel.set(Function.FK_MENUID, menuDictionary.getStr(Menu.PK_ID));
		dictionaryDel.set(Function.ORDER, "03");
		dictionaryDel.save();	
		
		Function dictionaryDictAdd = new Function();
		dictionaryDictAdd.set(Function.NAME, "新增");
		dictionaryDictAdd.set(Function.ELEM_ID, "addDict");
		dictionaryDictAdd.set(Function.ELEM_TYPE, "button");
		dictionaryDictAdd.set(Function.ELEM_STYLE, "btn btn-info btn-sm no-border");
		dictionaryDictAdd.set(Function.ELEM_ICON, "ace-icon fa fa-plus bigger-110");
		dictionaryDictAdd.set(Function.ACT_EVT, "onclick");
		dictionaryDictAdd.set(Function.ACT_URL, "goAdd('新增字典', 'system/admin/dictionary/add?type=1', 'table-dictionary');");
		dictionaryDictAdd.set(Function.FK_MENUID, menuDictionary.getStr(Menu.PK_ID));
		dictionaryDictAdd.set(Function.ORDER, "04");		
		dictionaryDictAdd.save();
				
		Function dictionaryDictEdit = new Function();
		dictionaryDictEdit.set(Function.NAME, "编辑");
		dictionaryDictEdit.set(Function.ELEM_ID, "editDict");
		dictionaryDictEdit.set(Function.ELEM_TYPE, "button");
		dictionaryDictEdit.set(Function.ELEM_STYLE, "btn btn-success btn-sm no-border");
		dictionaryDictEdit.set(Function.ELEM_ICON, "ace-icon fa fa-pencil-square-o bigger-110");
		dictionaryDictEdit.set(Function.ACT_EVT, "onclick");
		dictionaryDictEdit.set(Function.ACT_URL, "goUpdate('编辑字典', 'system/admin/dictionary/edit', 'table-dictionary');");
		dictionaryDictEdit.set(Function.FK_MENUID, menuDictionary.getStr(Menu.PK_ID));
		dictionaryDictEdit.set(Function.ORDER, "05");
		dictionaryDictEdit.save();
				
		Function dictionaryDictDel = new Function();
		dictionaryDictDel.set(Function.NAME, "删除");
		dictionaryDictDel.set(Function.ELEM_ID, "delDict");
		dictionaryDictDel.set(Function.ELEM_TYPE, "button");
		dictionaryDictDel.set(Function.ELEM_STYLE, "btn btn-danger btn-sm no-border");
		dictionaryDictDel.set(Function.ELEM_ICON, "ace-icon fa fa-trash-o bigger-110");
		dictionaryDictDel.set(Function.ACT_EVT, "onclick");
		dictionaryDictDel.set(Function.ACT_URL, "doDels('system/admin/dictionary/deletes', 'table-dictionary');");
		dictionaryDictDel.set(Function.FK_MENUID, menuDictionary.getStr(Menu.PK_ID));
		dictionaryDictDel.set(Function.ORDER, "06");
		dictionaryDictDel.save();	
		
		Menu menuPlatform = new Menu();
		menuPlatform.set(Menu.NAME, "平台管理");
		menuPlatform.set(Menu.ORDER, "03");
		menuPlatform.set(Menu.URL, "/system/admin/platform");
		menuPlatform.set(Menu.TYPE, 1);
		menuPlatform.set(Menu.FK_PID, moduleSys.getStr(Menu.PK_ID));
		menuPlatform.save();
		
		//mengde-platform
		Function platformAdd = new Function();
		platformAdd.set(Function.NAME, "新增");
		platformAdd.set(Function.ELEM_ID, "addPlatform");
		platformAdd.set(Function.ELEM_TYPE, "button");
		platformAdd.set(Function.ELEM_STYLE, "btn btn-info btn-sm no-border");
		platformAdd.set(Function.ELEM_ICON, "ace-icon fa fa-plus bigger-110");
		platformAdd.set(Function.ACT_EVT, "onclick");
		platformAdd.set(Function.ACT_URL, "goAdd('新增平台', 'system/admin/platform/add', 'table-platform');");
		platformAdd.set(Function.FK_MENUID, menuPlatform.getStr(Menu.PK_ID));
		platformAdd.set(Function.ORDER, "01");		
		platformAdd.save();
				
		Function platformEdit = new Function();
		platformEdit.set(Function.NAME, "编辑");
		platformEdit.set(Function.ELEM_ID, "editPlatform");
		platformEdit.set(Function.ELEM_TYPE, "button");
		platformEdit.set(Function.ELEM_STYLE, "btn btn-success btn-sm no-border");
		platformEdit.set(Function.ELEM_ICON, "ace-icon fa fa-pencil-square-o bigger-110");
		platformEdit.set(Function.ACT_EVT, "onclick");
		platformEdit.set(Function.ACT_URL, "goUpdate('编辑平台', 'system/admin/platform/edit', 'table-platform');");
		platformEdit.set(Function.FK_MENUID, menuPlatform.getStr(Menu.PK_ID));
		platformEdit.set(Function.ORDER, "02");
		platformEdit.save();
				
		Function platformDel = new Function();
		platformDel.set(Function.NAME, "删除");
		platformDel.set(Function.ELEM_ID, "delPlatform");
		platformDel.set(Function.ELEM_TYPE, "button");
		platformDel.set(Function.ELEM_STYLE, "btn btn-danger btn-sm no-border");
		platformDel.set(Function.ELEM_ICON, "ace-icon fa fa-trash-o bigger-110");
		platformDel.set(Function.ACT_EVT, "onclick");
		platformDel.set(Function.ACT_URL, "doDels('system/admin/platform/deletes', 'table-platform');");
		platformDel.set(Function.FK_MENUID, menuPlatform.getStr(Menu.PK_ID));
		platformDel.set(Function.ORDER, "03");
		platformDel.save();
		
		Menu menuMenu = new Menu();
		menuMenu.set(Menu.NAME, "菜单管理");
		menuMenu.set(Menu.ORDER, "04");
		menuMenu.set(Menu.URL, "/system/admin/menu");
		menuMenu.set(Menu.TYPE, 1);
		menuMenu.set(Menu.FK_PID, moduleSys.getStr(Menu.PK_ID));
		menuMenu.save();
		
		//mengde-menu
		Function moduleAdd = new Function();
		moduleAdd.set(Function.NAME, "新增");
		moduleAdd.set(Function.ELEM_ID, "addModule");
		moduleAdd.set(Function.ELEM_TYPE, "button");
		moduleAdd.set(Function.ELEM_STYLE, "btn btn-info btn-sm no-border");
		moduleAdd.set(Function.ELEM_ICON, "ace-icon fa fa-plus bigger-110");
		moduleAdd.set(Function.ACT_EVT, "onclick");
		moduleAdd.set(Function.ACT_URL, "goAdd('新增模块', 'system/admin/menu/add?type=0', 'table-module');");
		moduleAdd.set(Function.FK_MENUID, menuMenu.getStr(Menu.PK_ID));
		moduleAdd.set(Function.ORDER, "01");		
		moduleAdd.save();
				
		Function moduleEdit = new Function();
		moduleEdit.set(Function.NAME, "编辑");
		moduleEdit.set(Function.ELEM_ID, "editModule");
		moduleEdit.set(Function.ELEM_TYPE, "button");
		moduleEdit.set(Function.ELEM_STYLE, "btn btn-success btn-sm no-border");
		moduleEdit.set(Function.ELEM_ICON, "ace-icon fa fa-pencil-square-o bigger-110");
		moduleEdit.set(Function.ACT_EVT, "onclick");
		moduleEdit.set(Function.ACT_URL, "goUpdate('编辑模块', 'system/admin/menu/edit', 'table-module');");
		moduleEdit.set(Function.FK_MENUID, menuMenu.getStr(Menu.PK_ID));
		moduleEdit.set(Function.ORDER, "02");
		moduleEdit.save();
				
		Function moduleDel = new Function();
		moduleDel.set(Function.NAME, "删除");
		moduleDel.set(Function.ELEM_ID, "delModule");
		moduleDel.set(Function.ELEM_TYPE, "button");
		moduleDel.set(Function.ELEM_STYLE, "btn btn-danger btn-sm no-border");
		moduleDel.set(Function.ELEM_ICON, "ace-icon fa fa-trash-o bigger-110");
		moduleDel.set(Function.ACT_EVT, "onclick");
		moduleDel.set(Function.ACT_URL, "doDels('system/admin/menu/deletes', 'table-module');");
		moduleDel.set(Function.FK_MENUID, menuMenu.getStr(Menu.PK_ID));
		moduleDel.set(Function.ORDER, "03");
		moduleDel.save();
		
		Function menuAdd = new Function();
		menuAdd.set(Function.NAME, "新增");
		menuAdd.set(Function.ELEM_ID, "addMenu");
		menuAdd.set(Function.ELEM_TYPE, "button");
		menuAdd.set(Function.ELEM_STYLE, "btn btn-info btn-sm no-border");
		menuAdd.set(Function.ELEM_ICON, "ace-icon fa fa-plus bigger-110");
		menuAdd.set(Function.ACT_EVT, "onclick");
		menuAdd.set(Function.ACT_URL, "goAdd('新增菜单', 'system/admin/menu/add?type=1', 'table-menu');");
		menuAdd.set(Function.FK_MENUID, menuMenu.getStr(Menu.PK_ID));
		menuAdd.set(Function.ORDER, "04");		
		menuAdd.save();
				
		Function menuEdit = new Function();
		menuEdit.set(Function.NAME, "编辑");
		menuEdit.set(Function.ELEM_ID, "editMenu");
		menuEdit.set(Function.ELEM_TYPE, "button");
		menuEdit.set(Function.ELEM_STYLE, "btn btn-success btn-sm no-border");
		menuEdit.set(Function.ELEM_ICON, "ace-icon fa fa-pencil-square-o bigger-110");
		menuEdit.set(Function.ACT_EVT, "onclick");
		menuEdit.set(Function.ACT_URL, "goUpdate('编辑菜单', 'system/admin/menu/edit', 'table-menu');");
		menuEdit.set(Function.FK_MENUID, menuMenu.getStr(Menu.PK_ID));
		menuEdit.set(Function.ORDER, "05");
		menuEdit.save();
				
		Function menuDel = new Function();
		menuDel.set(Function.NAME, "删除");
		menuDel.set(Function.ELEM_ID, "delMenu");
		menuDel.set(Function.ELEM_TYPE, "button");
		menuDel.set(Function.ELEM_STYLE, "btn btn-danger btn-sm no-border");
		menuDel.set(Function.ELEM_ICON, "ace-icon fa fa-trash-o bigger-110");
		menuDel.set(Function.ACT_EVT, "onclick");
		menuDel.set(Function.ACT_URL, "doDels('system/admin/menu/deletes', 'table-menu');");
		menuDel.set(Function.FK_MENUID, menuMenu.getStr(Menu.PK_ID));
		menuDel.set(Function.ORDER, "06");
		menuDel.save();
				
		Menu menuFunc = new Menu();
		menuFunc.set(Menu.NAME, "功能管理");
		menuFunc.set(Menu.ORDER, "05");
		menuFunc.set(Menu.URL, "/system/admin/function");
		menuFunc.set(Menu.TYPE, 1);
		menuFunc.set(Menu.FK_PID, moduleSys.getStr(Menu.PK_ID));
		menuFunc.save();
		
		Function funcAdd = new Function();
		funcAdd.set(Function.NAME, "新增");
		funcAdd.set(Function.ELEM_ID, "addFunction");
		funcAdd.set(Function.ELEM_TYPE, "button");
		funcAdd.set(Function.ELEM_STYLE, "btn btn-info btn-sm no-border");
		funcAdd.set(Function.ELEM_ICON, "ace-icon fa fa-plus bigger-110");
		funcAdd.set(Function.ACT_EVT, "onclick");
		funcAdd.set(Function.ACT_URL, "goAdd('新增功能', 'system/admin/function/add?type=0', 'table-function');");
		funcAdd.set(Function.FK_MENUID, menuFunc.getStr(Menu.PK_ID));
		funcAdd.set(Function.ORDER, "01");		
		funcAdd.save();
		
		Function funcEdit = new Function();
		funcEdit.set(Function.NAME, "编辑");
		funcEdit.set(Function.ELEM_ID, "editFunction");
		funcEdit.set(Function.ELEM_TYPE, "button");
		funcEdit.set(Function.ELEM_STYLE, "btn btn-success btn-sm no-border");
		funcEdit.set(Function.ELEM_ICON, "ace-icon fa fa-pencil-square-o bigger-110");
		funcEdit.set(Function.ACT_EVT, "onclick");
		funcEdit.set(Function.ACT_URL, "goUpdate('编辑功能', 'system/admin/function/edit', 'table-function');");
		funcEdit.set(Function.FK_MENUID, menuFunc.getStr(Menu.PK_ID));
		funcEdit.set(Function.ORDER, "02");
		funcEdit.save();
		
		Function funcDel = new Function();
		funcDel.set(Function.NAME, "删除");
		funcDel.set(Function.ELEM_ID, "delFunction");
		funcDel.set(Function.ELEM_TYPE, "button");
		funcDel.set(Function.ELEM_STYLE, "btn btn-danger btn-sm no-border");
		funcDel.set(Function.ELEM_ICON, "ace-icon fa fa-trash-o bigger-110");
		funcDel.set(Function.ACT_EVT, "onclick");
		funcDel.set(Function.ACT_URL, "doDels('system/admin/function/deletes', 'table-function');");
		funcDel.set(Function.FK_MENUID, menuFunc.getStr(Menu.PK_ID));
		funcDel.set(Function.ORDER, "03");
		funcDel.save();
		
		Menu menuArea = new Menu();
		menuArea.set(Menu.NAME, "区域管理");
		menuArea.set(Menu.ORDER, "06");
		menuArea.set(Menu.URL, "/system/admin/area");
		menuArea.set(Menu.TYPE, 1);
		menuArea.set(Menu.FK_PID, moduleSys.getStr(Menu.PK_ID));
		menuArea.save();

		//mengde-area
		Function areaAdd = new Function();
		areaAdd.set(Function.NAME, "新增");
		areaAdd.set(Function.ELEM_ID, "addArea");
		areaAdd.set(Function.ELEM_TYPE, "button");
		areaAdd.set(Function.ELEM_STYLE, "btn btn-info btn-sm no-border");
		areaAdd.set(Function.ELEM_ICON, "ace-icon fa fa-plus bigger-110");
		areaAdd.set(Function.ACT_EVT, "onclick");
		areaAdd.set(Function.ACT_URL, "goAdd('新增区域', 'system/admin/area/add?level=0', 'table-area');");
		areaAdd.set(Function.FK_MENUID, menuArea.getStr(Menu.PK_ID));
		areaAdd.set(Function.ORDER, "01");		
		areaAdd.save();
		
		Function areaEdit = new Function();
		areaEdit.set(Function.NAME, "编辑");
		areaEdit.set(Function.ELEM_ID, "editArea");
		areaEdit.set(Function.ELEM_TYPE, "button");
		areaEdit.set(Function.ELEM_STYLE, "btn btn-success btn-sm no-border");
		areaEdit.set(Function.ELEM_ICON, "ace-icon fa fa-pencil-square-o bigger-110");
		areaEdit.set(Function.ACT_EVT, "onclick");
		areaEdit.set(Function.ACT_URL, "goUpdate('编辑区域', 'system/admin/area/edit', 'table-area');");
		areaEdit.set(Function.FK_MENUID, menuArea.getStr(Menu.PK_ID));
		areaEdit.set(Function.ORDER, "02");
		areaEdit.save();
		
		Function areaDel = new Function();
		areaDel.set(Function.NAME, "删除");
		areaDel.set(Function.ELEM_ID, "delArea");
		areaDel.set(Function.ELEM_TYPE, "button");
		areaDel.set(Function.ELEM_STYLE, "btn btn-danger btn-sm no-border");
		areaDel.set(Function.ELEM_ICON, "ace-icon fa fa-trash-o bigger-110");
		areaDel.set(Function.ACT_EVT, "onclick");
		areaDel.set(Function.ACT_URL, "doDels('system/admin/area/deletes', 'table-area', refreshTree);");
		areaDel.set(Function.FK_MENUID, menuArea.getStr(Menu.PK_ID));
		areaDel.set(Function.ORDER, "03");
		areaDel.save();
		
		Menu menuOrg = new Menu();
		menuOrg.set(Menu.NAME, "机构管理");
		menuOrg.set(Menu.ORDER, "07");
		menuOrg.set(Menu.URL, "/system/admin/org");
		menuOrg.set(Menu.TYPE, 1);
		menuOrg.set(Menu.FK_PID, moduleSys.getStr(Menu.PK_ID));
		menuOrg.save();
		
		//mengde-org
		Function orgAdd = new Function();
		orgAdd.set(Function.NAME, "新增");
		orgAdd.set(Function.ELEM_ID, "addOrg");
		orgAdd.set(Function.ELEM_TYPE, "button");
		orgAdd.set(Function.ELEM_STYLE, "btn btn-info btn-sm no-border");
		orgAdd.set(Function.ELEM_ICON, "ace-icon fa fa-plus bigger-110");
		orgAdd.set(Function.ACT_EVT, "onclick");
		orgAdd.set(Function.ACT_URL, "goAdd('新增机构', 'system/admin/org/add?level=0', 'table-org');");
		orgAdd.set(Function.FK_MENUID, menuOrg.getStr(Menu.PK_ID));
		orgAdd.set(Function.ORDER, "01");		
		orgAdd.save();
						
		Function orgEdit = new Function();
		orgEdit.set(Function.NAME, "编辑");
		orgEdit.set(Function.ELEM_ID, "editOrg");
		orgEdit.set(Function.ELEM_TYPE, "button");
		orgEdit.set(Function.ELEM_STYLE, "btn btn-success btn-sm no-border");
		orgEdit.set(Function.ELEM_ICON, "ace-icon fa fa-pencil-square-o bigger-110");
		orgEdit.set(Function.ACT_EVT, "onclick");
		orgEdit.set(Function.ACT_URL, "goUpdate('编辑机构', 'system/admin/org/edit', 'table-org');");
		orgEdit.set(Function.FK_MENUID, menuOrg.getStr(Menu.PK_ID));
		orgEdit.set(Function.ORDER, "02");
		orgEdit.save();
						
		Function orgDel = new Function();
		orgDel.set(Function.NAME, "删除");
		orgDel.set(Function.ELEM_ID, "delOrg");
		orgDel.set(Function.ELEM_TYPE, "button");
		orgDel.set(Function.ELEM_STYLE, "btn btn-danger btn-sm no-border");
		orgDel.set(Function.ELEM_ICON, "ace-icon fa fa-trash-o bigger-110");
		orgDel.set(Function.ACT_EVT, "onclick");
		orgDel.set(Function.ACT_URL, "doDels('system/admin/org/deletes', 'table-org', refreshTree);");
		orgDel.set(Function.FK_MENUID, menuOrg.getStr(Menu.PK_ID));
		orgDel.set(Function.ORDER, "03");
		orgDel.save();

		Menu menuGroup = new Menu();
		menuGroup.set(Menu.NAME, "用户组管理");
		menuGroup.set(Menu.ORDER, "08");
		menuGroup.set(Menu.URL, "/system/admin/group");
		menuGroup.set(Menu.TYPE, 1);
		menuGroup.set(Menu.FK_PID, moduleSys.getStr(Menu.PK_ID));
		menuGroup.save();
		
		//mengde-group
		Function groupAdd = new Function();
		groupAdd.set(Function.NAME, "新增");
		groupAdd.set(Function.ELEM_ID, "addGroup");
		groupAdd.set(Function.ELEM_TYPE, "button");
		groupAdd.set(Function.ELEM_STYLE, "btn btn-info btn-sm no-border");
		groupAdd.set(Function.ELEM_ICON, "ace-icon fa fa-plus bigger-110");
		groupAdd.set(Function.ACT_EVT, "onclick");
		groupAdd.set(Function.ACT_URL, "goAddBefore('');");
		groupAdd.set(Function.FK_MENUID, menuGroup.getStr(Menu.PK_ID));
		groupAdd.set(Function.ORDER, "01");		
		groupAdd.save();
				
		Function groupEdit = new Function();
		groupEdit.set(Function.NAME, "编辑");
		groupEdit.set(Function.ELEM_ID, "editGroup");
		groupEdit.set(Function.ELEM_TYPE, "button");
		groupEdit.set(Function.ELEM_STYLE, "btn btn-success btn-sm no-border");
		groupEdit.set(Function.ELEM_ICON, "ace-icon fa fa-pencil-square-o bigger-110");
		groupEdit.set(Function.ACT_EVT, "onclick");
		groupEdit.set(Function.ACT_URL, "goUpdate('编辑用户组', 'system/admin/group/edit', 'table-group');");
		groupEdit.set(Function.FK_MENUID, menuGroup.getStr(Menu.PK_ID));
		groupEdit.set(Function.ORDER, "02");
		groupEdit.save();
				
		Function groupDel = new Function();
		groupDel.set(Function.NAME, "删除");
		groupDel.set(Function.ELEM_ID, "delGroup");
		groupDel.set(Function.ELEM_TYPE, "button");
		groupDel.set(Function.ELEM_STYLE, "btn btn-danger btn-sm no-border");
		groupDel.set(Function.ELEM_ICON, "ace-icon fa fa-trash-o bigger-110");
		groupDel.set(Function.ACT_EVT, "onclick");
		groupDel.set(Function.ACT_URL, "doDels('system/admin/group/deletes', 'table-group');");
		groupDel.set(Function.FK_MENUID, menuGroup.getStr(Menu.PK_ID));
		groupDel.set(Function.ORDER, "03");
		groupDel.save();
		
		Function groupAlloc = new Function();
		groupAlloc.set(Function.NAME, "分配角色");
		groupAlloc.set(Function.ELEM_ID, "allocRole");
		groupAlloc.set(Function.ELEM_TYPE, "button");
		groupAlloc.set(Function.ELEM_STYLE, "btn btn-success btn-sm no-border");
		groupAlloc.set(Function.ELEM_ICON, "ace-icon fa fa-pencil-square-o bigger-110");
		groupAlloc.set(Function.ACT_EVT, "onclick");
		groupAlloc.set(Function.ACT_URL, "goAlloc('分配角色', 'system/admin/group/allocRole');");
		groupAlloc.set(Function.FK_MENUID, menuGroup.getStr(Menu.PK_ID));
		groupAlloc.set(Function.ORDER, "04");
		groupAlloc.save();	
		
		Menu menuAccount = new Menu();
		menuAccount.set(Menu.NAME, "用户管理");
		menuAccount.set(Menu.ORDER, "09");
		menuAccount.set(Menu.URL, "/system/admin/account");
		menuAccount.set(Menu.TYPE, 1);
		menuAccount.set(Menu.FK_PID, moduleSys.getStr(Menu.PK_ID));
		menuAccount.save();
		
		//mengde-account
		Function accountAdd = new Function();
		accountAdd.set(Function.NAME, "新增");
		accountAdd.set(Function.ELEM_ID, "addAccount");
		accountAdd.set(Function.ELEM_TYPE, "button");
		accountAdd.set(Function.ELEM_STYLE, "btn btn-info btn-sm no-border");
		accountAdd.set(Function.ELEM_ICON, "ace-icon fa fa-plus bigger-110");
		accountAdd.set(Function.ACT_EVT, "onclick");
		accountAdd.set(Function.ACT_URL, "goAddBefore('');");
		accountAdd.set(Function.FK_MENUID, menuAccount.getStr(Menu.PK_ID));
		accountAdd.set(Function.ORDER, "01");		
		accountAdd.save();
		
		Function accountEdit = new Function();
		accountEdit.set(Function.NAME, "编辑");
		accountEdit.set(Function.ELEM_ID, "editAccount");
		accountEdit.set(Function.ELEM_TYPE, "button");
		accountEdit.set(Function.ELEM_STYLE, "btn btn-success btn-sm no-border");
		accountEdit.set(Function.ELEM_ICON, "ace-icon fa fa-pencil-square-o bigger-110");
		accountEdit.set(Function.ACT_EVT, "onclick");
		accountEdit.set(Function.ACT_URL, "goUpdate('编辑账号', 'system/admin/account/edit', 'table-account');");
		accountEdit.set(Function.FK_MENUID, menuAccount.getStr(Menu.PK_ID));
		accountEdit.set(Function.ORDER, "02");
		accountEdit.save();
		
		Function accountDel = new Function();
		accountDel.set(Function.NAME, "删除");
		accountDel.set(Function.ELEM_ID, "delAccount");
		accountDel.set(Function.ELEM_TYPE, "button");
		accountDel.set(Function.ELEM_STYLE, "btn btn-danger btn-sm no-border");
		accountDel.set(Function.ELEM_ICON, "ace-icon fa fa-trash-o bigger-110");
		accountDel.set(Function.ACT_EVT, "onclick");
		accountDel.set(Function.ACT_URL, "doDels('system/admin/account/deletes', 'table-account');");
		accountDel.set(Function.FK_MENUID, menuAccount.getStr(Menu.PK_ID));
		accountDel.set(Function.ORDER, "03");
		accountDel.save();
		
		Function accountAlloc = new Function();
		accountAlloc.set(Function.NAME, "分配用户组");
		accountAlloc.set(Function.ELEM_ID, "allocGroup");
		accountAlloc.set(Function.ELEM_TYPE, "button");
		accountAlloc.set(Function.ELEM_STYLE, "btn btn-success btn-sm no-border");
		accountAlloc.set(Function.ELEM_ICON, "ace-icon fa fa-pencil-square-o bigger-110");
		accountAlloc.set(Function.ACT_EVT, "onclick");
		accountAlloc.set(Function.ACT_URL, "goAlloc('分配用户组', 'system/admin/account/allocGroup');");
		accountAlloc.set(Function.FK_MENUID, menuAccount.getStr(Menu.PK_ID));
		accountAlloc.set(Function.ORDER, "04");
		accountAlloc.save();

		Menu menuRole = new Menu();
		menuRole.set(Menu.NAME, "角色管理");
		menuRole.set(Menu.ORDER, "10");
		menuRole.set(Menu.URL, "/system/admin/role");
		menuRole.set(Menu.TYPE, 1);
		menuRole.set(Menu.FK_PID, moduleSys.getStr(Menu.PK_ID));
		menuRole.save();
		
		//mengde-role
		Function roleAdd = new Function();
		roleAdd.set(Function.NAME, "新增");
		roleAdd.set(Function.ELEM_ID, "addRole");
		roleAdd.set(Function.ELEM_TYPE, "button");
		roleAdd.set(Function.ELEM_STYLE, "btn btn-info btn-sm no-border");
		roleAdd.set(Function.ELEM_ICON, "ace-icon fa fa-plus bigger-110");
		roleAdd.set(Function.ACT_EVT, "onclick");
		roleAdd.set(Function.ACT_URL, "goAdd('新增角色', 'system/admin/role/add', 'table-role');");
		roleAdd.set(Function.FK_MENUID, menuRole.getStr(Menu.PK_ID));
		roleAdd.set(Function.ORDER, "01");		
		roleAdd.save();
		
		Function roleEdit = new Function();
		roleEdit.set(Function.NAME, "编辑");
		roleEdit.set(Function.ELEM_ID, "editRole");
		roleEdit.set(Function.ELEM_TYPE, "button");
		roleEdit.set(Function.ELEM_STYLE, "btn btn-success btn-sm no-border");
		roleEdit.set(Function.ELEM_ICON, "ace-icon fa fa-pencil-square-o bigger-110");
		roleEdit.set(Function.ACT_EVT, "onclick");
		roleEdit.set(Function.ACT_URL, "goUpdate('编辑角色', 'system/admin/role/edit', 'table-role');");
		roleEdit.set(Function.FK_MENUID, menuRole.getStr(Menu.PK_ID));
		roleEdit.set(Function.ORDER, "02");
		roleEdit.save();
		
		Function roleDel = new Function();
		roleDel.set(Function.NAME, "删除");
		roleDel.set(Function.ELEM_ID, "delRole");
		roleDel.set(Function.ELEM_TYPE, "button");
		roleDel.set(Function.ELEM_STYLE, "btn btn-danger btn-sm no-border");
		roleDel.set(Function.ELEM_ICON, "ace-icon fa fa-trash-o bigger-110");
		roleDel.set(Function.ACT_EVT, "onclick");
		roleDel.set(Function.ACT_URL, "doDels('system/admin/role/deletes', 'table-role');");
		roleDel.set(Function.FK_MENUID, menuRole.getStr(Menu.PK_ID));
		roleDel.set(Function.ORDER, "03");
		roleDel.save();
		
		Function roleAlloc = new Function();
		roleAlloc.set(Function.NAME, "分配权限");
		roleAlloc.set(Function.ELEM_ID, "allocPermission");
		roleAlloc.set(Function.ELEM_TYPE, "button");
		roleAlloc.set(Function.ELEM_STYLE, "btn btn-success btn-sm no-border");
		roleAlloc.set(Function.ELEM_ICON, "ace-icon fa fa-pencil-square-o bigger-110");
		roleAlloc.set(Function.ACT_EVT, "onclick");
		roleAlloc.set(Function.ACT_URL, "goAlloc('分配权限', 'system/admin/role/allocPermission');");
		roleAlloc.set(Function.FK_MENUID, menuRole.getStr(Menu.PK_ID));
		roleAlloc.set(Function.ORDER, "04");
		roleAlloc.save();
		
		Menu menuPerm = new Menu();
		menuPerm.set(Menu.NAME, "权限管理");
		menuPerm.set(Menu.ORDER, "11");
		menuPerm.set(Menu.URL, "/system/admin/permission");
		menuPerm.set(Menu.TYPE, 1);
		menuPerm.set(Menu.FK_PID, moduleSys.getStr(Menu.PK_ID));
		menuPerm.save();
		
		//mengde-perm-platform
		Function permPlatAdd = new Function();
		permPlatAdd.set(Function.NAME, "新增");
		permPlatAdd.set(Function.ELEM_ID, "addPermPlatform");
		permPlatAdd.set(Function.ELEM_TYPE, "button");
		permPlatAdd.set(Function.ELEM_STYLE, "btn btn-info btn-sm no-border");
		permPlatAdd.set(Function.ELEM_ICON, "ace-icon fa fa-plus bigger-110");
		permPlatAdd.set(Function.ACT_EVT, "onclick");
		permPlatAdd.set(Function.ACT_URL, "goAdd('新增平台权限', 'system/admin/permission/add?type=0', 'table-perm-platform');");
		permPlatAdd.set(Function.FK_MENUID, menuPerm.getStr(Menu.PK_ID));
		permPlatAdd.set(Function.ORDER, "01");		
		permPlatAdd.save();
		
		Function permPlatEdit = new Function();
		permPlatEdit.set(Function.NAME, "编辑");
		permPlatEdit.set(Function.ELEM_ID, "editPermPlatform");
		permPlatEdit.set(Function.ELEM_TYPE, "button");
		permPlatEdit.set(Function.ELEM_STYLE, "btn btn-success btn-sm no-border");
		permPlatEdit.set(Function.ELEM_ICON, "ace-icon fa fa-pencil-square-o bigger-110");
		permPlatEdit.set(Function.ACT_EVT, "onclick");
		permPlatEdit.set(Function.ACT_URL, "goUpdate('编辑平台权限', 'system/admin/permission/edit', 'table-perm-platform');");
		permPlatEdit.set(Function.FK_MENUID, menuPerm.getStr(Menu.PK_ID));
		permPlatEdit.set(Function.ORDER, "02");
		permPlatEdit.save();
		
		Function permPlatDel = new Function();
		permPlatDel.set(Function.NAME, "删除");
		permPlatDel.set(Function.ELEM_ID, "delPermPlatform");
		permPlatDel.set(Function.ELEM_TYPE, "button");
		permPlatDel.set(Function.ELEM_STYLE, "btn btn-danger btn-sm no-border");
		permPlatDel.set(Function.ELEM_ICON, "ace-icon fa fa-trash-o bigger-110");
		permPlatDel.set(Function.ACT_EVT, "onclick");
		permPlatDel.set(Function.ACT_URL, "doDels('system/admin/permission/deletes', 'table-perm-platform');");
		permPlatDel.set(Function.FK_MENUID, menuPerm.getStr(Menu.PK_ID));
		permPlatDel.set(Function.ORDER, "03");
		permPlatDel.save();	
		
		//mengde-perm-module
		Function permModAdd = new Function();
		permModAdd.set(Function.NAME, "新增");
		permModAdd.set(Function.ELEM_ID, "addPermModule");
		permModAdd.set(Function.ELEM_TYPE, "button");
		permModAdd.set(Function.ELEM_STYLE, "btn btn-info btn-sm no-border");
		permModAdd.set(Function.ELEM_ICON, "ace-icon fa fa-plus bigger-110");
		permModAdd.set(Function.ACT_EVT, "onclick");
		permModAdd.set(Function.ACT_URL, "goAdd('新增模块权限', 'system/admin/permission/add?type=1', 'table-perm-module');");
		permModAdd.set(Function.FK_MENUID, menuPerm.getStr(Menu.PK_ID));
		permModAdd.set(Function.ORDER, "04");		
		permModAdd.save();
		
		Function permModEdit = new Function();
		permModEdit.set(Function.NAME, "编辑");
		permModEdit.set(Function.ELEM_ID, "editPermModule");
		permModEdit.set(Function.ELEM_TYPE, "button");
		permModEdit.set(Function.ELEM_STYLE, "btn btn-success btn-sm no-border");
		permModEdit.set(Function.ELEM_ICON, "ace-icon fa fa-pencil-square-o bigger-110");
		permModEdit.set(Function.ACT_EVT, "onclick");
		permModEdit.set(Function.ACT_URL, "goUpdate('编辑模块权限', 'system/admin/permission/edit', 'table-perm-module');");
		permModEdit.set(Function.FK_MENUID, menuPerm.getStr(Menu.PK_ID));
		permModEdit.set(Function.ORDER, "05");
		permModEdit.save();
		
		Function permModDel = new Function();
		permModDel.set(Function.NAME, "删除");
		permModDel.set(Function.ELEM_ID, "delPermModule");
		permModDel.set(Function.ELEM_TYPE, "button");
		permModDel.set(Function.ELEM_STYLE, "btn btn-danger btn-sm no-border");
		permModDel.set(Function.ELEM_ICON, "ace-icon fa fa-trash-o bigger-110");
		permModDel.set(Function.ACT_EVT, "onclick");
		permModDel.set(Function.ACT_URL, "doDels('system/admin/permission/deletes', 'table-perm-module');");
		permModDel.set(Function.FK_MENUID, menuPerm.getStr(Menu.PK_ID));
		permModDel.set(Function.ORDER, "06");
		permModDel.save();
		
		//mengde-perm-menu
		Function permAdd = new Function();
		permAdd.set(Function.NAME, "新增");
		permAdd.set(Function.ELEM_ID, "addPerm");
		permAdd.set(Function.ELEM_TYPE, "button");
		permAdd.set(Function.ELEM_STYLE, "btn btn-info btn-sm no-border");
		permAdd.set(Function.ELEM_ICON, "ace-icon fa fa-plus bigger-110");
		permAdd.set(Function.ACT_EVT, "onclick");
		permAdd.set(Function.ACT_URL, "goAdd('新增菜单权限', 'system/admin/permission/add?type=2', 'table-perm-menu');");
		permAdd.set(Function.FK_MENUID, menuPerm.getStr(Menu.PK_ID));
		permAdd.set(Function.ORDER, "07");		
		permAdd.save();
		
		Function permEdit = new Function();
		permEdit.set(Function.NAME, "编辑");
		permEdit.set(Function.ELEM_ID, "editPerm");
		permEdit.set(Function.ELEM_TYPE, "button");
		permEdit.set(Function.ELEM_STYLE, "btn btn-success btn-sm no-border");
		permEdit.set(Function.ELEM_ICON, "ace-icon fa fa-pencil-square-o bigger-110");
		permEdit.set(Function.ACT_EVT, "onclick");
		permEdit.set(Function.ACT_URL, "goUpdate('编辑菜单权限', 'system/admin/permission/edit', 'table-perm-menu');");
		permEdit.set(Function.FK_MENUID, menuPerm.getStr(Menu.PK_ID));
		permEdit.set(Function.ORDER, "08");
		permEdit.save();
		
		Function permDel = new Function();
		permDel.set(Function.NAME, "删除");
		permDel.set(Function.ELEM_ID, "delPerm");
		permDel.set(Function.ELEM_TYPE, "button");
		permDel.set(Function.ELEM_STYLE, "btn btn-danger btn-sm no-border");
		permDel.set(Function.ELEM_ICON, "ace-icon fa fa-trash-o bigger-110");
		permDel.set(Function.ACT_EVT, "onclick");
		permDel.set(Function.ACT_URL, "doDels('system/admin/permission/deletes', 'table-perm-menu');");
		permDel.set(Function.FK_MENUID, menuPerm.getStr(Menu.PK_ID));
		permDel.set(Function.ORDER, "09");
		permDel.save();
		
		//mengde-perm-func
		Function permfuncAdd = new Function();
		permfuncAdd.set(Function.NAME, "新增");
		permfuncAdd.set(Function.ELEM_ID, "addPermFunc");
		permfuncAdd.set(Function.ELEM_TYPE, "button");
		permfuncAdd.set(Function.ELEM_STYLE, "btn btn-info btn-sm no-border");
		permfuncAdd.set(Function.ELEM_ICON, "ace-icon fa fa-plus bigger-110");
		permfuncAdd.set(Function.ACT_EVT, "onclick");
		permfuncAdd.set(Function.ACT_URL, "goAdd('新增功能权限', 'system/admin/permission/add?type=3', 'table-perm-function');");
		permfuncAdd.set(Function.FK_MENUID, menuPerm.getStr(Menu.PK_ID));
		permfuncAdd.set(Function.ORDER, "10");		
		permfuncAdd.save();
		
		Function permfuncEdit = new Function();
		permfuncEdit.set(Function.NAME, "编辑");
		permfuncEdit.set(Function.ELEM_ID, "editPermFunc");
		permfuncEdit.set(Function.ELEM_TYPE, "button");
		permfuncEdit.set(Function.ELEM_STYLE, "btn btn-success btn-sm no-border");
		permfuncEdit.set(Function.ELEM_ICON, "ace-icon fa fa-pencil-square-o bigger-110");
		permfuncEdit.set(Function.ACT_EVT, "onclick");
		permfuncEdit.set(Function.ACT_URL, "goUpdate('编辑功能权限', 'system/admin/permission/edit', 'table-perm-function');");
		permfuncEdit.set(Function.FK_MENUID, menuPerm.getStr(Menu.PK_ID));
		permfuncEdit.set(Function.ORDER, "11");
		permfuncEdit.save();
		
		Function permfuncDel = new Function();
		permfuncDel.set(Function.NAME, "删除");
		permfuncDel.set(Function.ELEM_ID, "delPermFunc");
		permfuncDel.set(Function.ELEM_TYPE, "button");
		permfuncDel.set(Function.ELEM_STYLE, "btn btn-danger btn-sm no-border");
		permfuncDel.set(Function.ELEM_ICON, "ace-icon fa fa-trash-o bigger-110");
		permfuncDel.set(Function.ACT_EVT, "onclick");
		permfuncDel.set(Function.ACT_URL, "doDels('system/admin/permission/deletes', 'table-perm-function');");
		permfuncDel.set(Function.FK_MENUID, menuPerm.getStr(Menu.PK_ID));
		permfuncDel.set(Function.ORDER, "12");
		permfuncDel.save();

		Menu moduleUCenter = new Menu();
		moduleUCenter.set(Menu.NAME, "用户中心");
		moduleUCenter.set(Menu.ORDER, "02");
		moduleUCenter.set(Menu.TYPE, 0);
		moduleUCenter.set(Menu.FK_PLATFORMID, basePlatform.getStr(Platform.PK_ID));
		moduleUCenter.save();
		
		Menu menuUAccount = new Menu();
		menuUAccount.set(Menu.NAME, "个人账号");
		menuUAccount.set(Menu.ORDER, "01");
		menuUAccount.set(Menu.URL, "/system/ucenter/account");
		menuUAccount.set(Menu.TYPE, 1);
		menuUAccount.set(Menu.FK_PID, moduleUCenter.getStr(Menu.PK_ID));
		menuUAccount.save();
		
		Menu menuUUser = new Menu();
		menuUUser.set(Menu.NAME, "个人资料");
		menuUUser.set(Menu.ORDER, "02");
		menuUUser.set(Menu.URL, "/system/ucenter/user");
		menuUUser.set(Menu.TYPE, 1);
		menuUUser.set(Menu.FK_PID, moduleUCenter.getStr(Menu.PK_ID));
		menuUUser.save();
		
		Menu menuUPwd = new Menu();
		menuUPwd.set(Menu.NAME, "密码修改");
		menuUPwd.set(Menu.ORDER, "03");
		menuUPwd.set(Menu.URL, "/system/ucenter/changePwd");
		menuUPwd.set(Menu.TYPE, 1);
		menuUPwd.set(Menu.FK_PID, moduleUCenter.getStr(Menu.PK_ID));
		menuUPwd.save();
		
		Menu moduleMonitor = new Menu();
		moduleMonitor.set(Menu.NAME, "系统监控");
		moduleMonitor.set(Menu.ORDER, "02");
		moduleMonitor.set(Menu.TYPE, 0);
		moduleMonitor.set(Menu.FK_PLATFORMID, basePlatform.getStr(Platform.PK_ID));
		moduleMonitor.save();
		
		Menu menuDruid = new Menu();
		menuDruid.set(Menu.NAME, "数据监控");
		menuDruid.set(Menu.ORDER, "01");
		menuDruid.set(Menu.URL, "/system/monitor/druid");
		menuDruid.set(Menu.TYPE, 1);
		menuDruid.set(Menu.FK_PID, moduleMonitor.getStr(Menu.PK_ID));
		menuDruid.save();
		
		Menu menuLog = new Menu();
		menuLog.set(Menu.NAME, "日志监控");
		menuLog.set(Menu.ORDER, "02");
		menuLog.set(Menu.URL, "/system/monitor/log");
		menuLog.set(Menu.TYPE, 1);
		menuLog.set(Menu.FK_PID, moduleMonitor.getStr(Menu.PK_ID));
		menuLog.save();

		 /* ××××××××××××××××××××××××××××××××××× 
		  * × 系统关系数据建立 × AccountId NdiMk6HYj7ZRK9qLq4w28B
		  *  ×××××××××××××××××××××××××××××××××××*/

		Group groupAdmin = new Group();
		groupAdmin.set(Group.NAME, "超级管理组");
		groupAdmin.set(Group.CODE, "G_ADMIN");
		groupAdmin.set(Group.FK_ORGID, orgId);
		groupAdmin.save();

		Role roleSuper = new Role();
		roleSuper.set(Role.CODE, "Administrator");
		roleSuper.set(Role.NAME, "超级系统管理员");
		roleSuper.set(Role.AVAILABLE, 1);
		roleSuper.save();
		
		Db.update("insert into sys_group_role(groupid, roleid) values(?, ?)", groupAdmin.getStr(Group.PK_ID), roleSuper.getStr(Role.PK_ID));
		Db.update("insert into sys_group_account(groupid, accountid) values(?, ?)", groupAdmin.getStr(Group.PK_ID), accountId);

		/*
		 * ××××××××××××××××××××××××××××××××××× 
		 * × 角色权限数据建立 × AccountId NdiMk6HYj7ZRK9qLq4w28B
		 * ×××××××××××××××××××××××××××××××××××
		 */

		Permission permPlatform = new Permission();
		permPlatform.set(Permission.NAME, "基础平台权限");
		permPlatform.set(Permission.CODE, "P-BASE");
		permPlatform.set(Permission.URL, "/system/");
		permPlatform.set(Permission.TYPE, "0");
		permPlatform.set(Permission.AVAILABLE, "1");
		permPlatform.save();
		Db.update("insert into sys_permission_platform(permissionid, platformId) values(?, ?)", permPlatform.getStr(Permission.PK_ID), basePlatform.getStr(Platform.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permPlatform.getStr(Permission.PK_ID));
		
		Permission permModuleSys = new Permission();
		permModuleSys.set(Permission.NAME, "基础管理权限");
		permModuleSys.set(Permission.CODE, "P-BASE:MOD-SYSTEM");
		permModuleSys.set(Permission.URL, "/system/admin/**");
		permModuleSys.set(Permission.TYPE, "1");
		permModuleSys.set(Permission.AVAILABLE, "1");
		permModuleSys.save();
		Db.update("insert into sys_permission_menu(permissionid, menuid) values(?,?)", permModuleSys.getStr(Permission.PK_ID), moduleSys.getStr(Menu.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permModuleSys.getStr(Permission.PK_ID));
		
		Permission permMenuParam = new Permission();
		permMenuParam.set(Permission.NAME, "参数管理权限");
		permMenuParam.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-PARAM");
		permMenuParam.set(Permission.URL, "/system/admin/param/**");
		permMenuParam.set(Permission.TYPE, "2");
		permMenuParam.set(Permission.AVAILABLE, "1");
		permMenuParam.save();
		Db.update("insert into sys_permission_menu(permissionid, menuid) values(?,?)", permMenuParam.getStr(Permission.PK_ID), menuParam.getStr(Menu.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permMenuParam.getStr(Permission.PK_ID));

		//mengde-param
		Permission permParamAdd = new Permission();
		permParamAdd.set(Permission.NAME, "参数新增权限");
		permParamAdd.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-PARAM:ADD");
		permParamAdd.set(Permission.URL, "/system/admin/param/add");
		permParamAdd.set(Permission.TYPE, "3");
		permParamAdd.set(Permission.AVAILABLE, "1");
		permParamAdd.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permParamAdd.getStr(Permission.PK_ID), paramAdd.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permParamAdd.getStr(Permission.PK_ID));
		
		Permission permParamEdit = new Permission();
		permParamEdit.set(Permission.NAME, "参数编辑权限");
		permParamEdit.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-PARAM:EDIT");
		permParamEdit.set(Permission.URL, "/system/admin/param/edit");
		permParamEdit.set(Permission.TYPE, "3");
		permParamEdit.set(Permission.AVAILABLE, "1");
		permParamEdit.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permParamEdit.getStr(Permission.PK_ID), paramEdit.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permParamEdit.getStr(Permission.PK_ID));
		
		Permission permParamDel = new Permission();
		permParamDel.set(Permission.NAME, "参数删除权限");
		permParamDel.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-PARAM:DELETES");
		permParamDel.set(Permission.URL, "/system/admin/param/deletes");
		permParamDel.set(Permission.TYPE, "3");
		permParamDel.set(Permission.AVAILABLE, "1");
		permParamDel.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permParamDel.getStr(Permission.PK_ID), paramDel.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permParamDel.getStr(Permission.PK_ID));
		
		Permission permMenuDictionary = new Permission();
		permMenuDictionary.set(Permission.NAME, "字典管理权限");
		permMenuDictionary.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-DICT");
		permMenuDictionary.set(Permission.URL, "/system/admin/dictionary/**");
		permMenuDictionary.set(Permission.TYPE, "2");
		permMenuDictionary.set(Permission.AVAILABLE, "1");
		permMenuDictionary.save();
		Db.update("insert into sys_permission_menu(permissionid, menuid) values(?,?)", permMenuDictionary.getStr(Permission.PK_ID), menuDictionary.getStr(Menu.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permMenuDictionary.getStr(Permission.PK_ID));
		
		//mengde-dictionary		
		Permission permDictionaryAdd = new Permission();
		permDictionaryAdd.set(Permission.NAME, "字典目录新增权限");
		permDictionaryAdd.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-DICT:ADD");
		permDictionaryAdd.set(Permission.URL, "/system/admin/dictionary/add");
		permDictionaryAdd.set(Permission.TYPE, "3");
		permDictionaryAdd.set(Permission.AVAILABLE, "1");
		permDictionaryAdd.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permDictionaryAdd.getStr(Permission.PK_ID), dictionaryAdd.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permDictionaryAdd.getStr(Permission.PK_ID));
				
		Permission permDictionaryEdit = new Permission();
		permDictionaryEdit.set(Permission.NAME, "字典目录编辑权限");
		permDictionaryEdit.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-DICT:EDIT");
		permDictionaryEdit.set(Permission.URL, "/system/admin/dictionary/edit");
		permDictionaryEdit.set(Permission.TYPE, "3");
		permDictionaryEdit.set(Permission.AVAILABLE, "1");
		permDictionaryEdit.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permDictionaryEdit.getStr(Permission.PK_ID), dictionaryEdit.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permDictionaryEdit.getStr(Permission.PK_ID));
				
		Permission permDictionaryDel = new Permission();
		permDictionaryDel.set(Permission.NAME, "字典目录删除权限");
		permDictionaryDel.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-DICT:DELETES");
		permDictionaryDel.set(Permission.URL, "/system/admin/dictionary/deletes");
		permDictionaryDel.set(Permission.TYPE, "3");
		permDictionaryDel.set(Permission.AVAILABLE, "1");
		permDictionaryDel.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permDictionaryDel.getStr(Permission.PK_ID), dictionaryDel.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permDictionaryDel.getStr(Permission.PK_ID));
		
		Permission permDictionaryDictAdd = new Permission();
		permDictionaryDictAdd.set(Permission.NAME, "字典新增权限");
		permDictionaryDictAdd.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-DICT:ADD-DICT");
		permDictionaryDictAdd.set(Permission.URL, "/system/admin/dictionary/add?type=1");
		permDictionaryDictAdd.set(Permission.TYPE, "3");
		permDictionaryDictAdd.set(Permission.AVAILABLE, "1");
		permDictionaryDictAdd.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permDictionaryDictAdd.getStr(Permission.PK_ID), dictionaryDictAdd.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permDictionaryDictAdd.getStr(Permission.PK_ID));
				
		Permission permDictionaryDictEdit = new Permission();
		permDictionaryDictEdit.set(Permission.NAME, "字典编辑权限");
		permDictionaryDictEdit.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-DICT:EDIT-DICT");
		permDictionaryDictEdit.set(Permission.URL, "/system/admin/dictionary/edit?type=1");
		permDictionaryDictEdit.set(Permission.TYPE, "3");
		permDictionaryDictEdit.set(Permission.AVAILABLE, "1");
		permDictionaryDictEdit.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permDictionaryDictEdit.getStr(Permission.PK_ID), dictionaryDictEdit.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permDictionaryDictEdit.getStr(Permission.PK_ID));
				
		Permission permDictionaryDictDel = new Permission();
		permDictionaryDictDel.set(Permission.NAME, "字典删除权限");
		permDictionaryDictDel.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-DICT:DELETES-DICT");
		permDictionaryDictDel.set(Permission.URL, "/system/admin/dictionary/deletes?type=1");
		permDictionaryDictDel.set(Permission.TYPE, "3");
		permDictionaryDictDel.set(Permission.AVAILABLE, "1");
		permDictionaryDictDel.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permDictionaryDictDel.getStr(Permission.PK_ID), dictionaryDictDel.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permDictionaryDictDel.getStr(Permission.PK_ID));
		
		Permission permMenuPlatform = new Permission();
		permMenuPlatform.set(Permission.NAME, "平台管理权限");
		permMenuPlatform.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-PLF");
		permMenuPlatform.set(Permission.URL, "/system/admin/platform/**");
		permMenuPlatform.set(Permission.TYPE, "2");
		permMenuPlatform.set(Permission.AVAILABLE, "1");
		permMenuPlatform.save();
		Db.update("insert into sys_permission_menu(permissionid, menuid) values(?,?)", permMenuPlatform.getStr(Permission.PK_ID), menuPlatform.getStr(Menu.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permMenuPlatform.getStr(Permission.PK_ID));

		//mengde-platform		
		Permission permPlatformAdd = new Permission();
		permPlatformAdd.set(Permission.NAME, "平台新增权限");
		permPlatformAdd.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-PLF:ADD");
		permPlatformAdd.set(Permission.URL, "/system/admin/platform/add");
		permPlatformAdd.set(Permission.TYPE, "3");
		permPlatformAdd.set(Permission.AVAILABLE, "1");
		permPlatformAdd.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permPlatformAdd.getStr(Permission.PK_ID), platformAdd.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permPlatformAdd.getStr(Permission.PK_ID));
						
		Permission permPlatformEdit = new Permission();
		permPlatformEdit.set(Permission.NAME, "平台编辑权限");
		permPlatformEdit.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-PLF:EDIT");
		permPlatformEdit.set(Permission.URL, "/system/admin/platform/edit");
		permPlatformEdit.set(Permission.TYPE, "3");
		permPlatformEdit.set(Permission.AVAILABLE, "1");
		permPlatformEdit.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permPlatformEdit.getStr(Permission.PK_ID), platformEdit.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permPlatformEdit.getStr(Permission.PK_ID));
				
		Permission permPlatformDel = new Permission();
		permPlatformDel.set(Permission.NAME, "平台删除权限");
		permPlatformDel.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-PLF:DELETES");
		permPlatformDel.set(Permission.URL, "/system/admin/platform/deletes");
		permPlatformDel.set(Permission.TYPE, "3");
		permPlatformDel.set(Permission.AVAILABLE, "1");
		permPlatformDel.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permPlatformDel.getStr(Permission.PK_ID), platformDel.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permPlatformDel.getStr(Permission.PK_ID));

		Permission permMenuMenu = new Permission();
		permMenuMenu.set(Permission.NAME, "菜单管理权限");
		permMenuMenu.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-MENU");
		permMenuMenu.set(Permission.URL, "/system/admin/menu/**");
		permMenuMenu.set(Permission.TYPE, "2");
		permMenuMenu.set(Permission.AVAILABLE, "1");
		permMenuMenu.save();
		Db.update("insert into sys_permission_menu(permissionid, menuid) values(?,?)", permMenuMenu.getStr(Permission.PK_ID), menuMenu.getStr(Menu.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permMenuMenu.getStr(Permission.PK_ID));

		//mengde-menu
		Permission permModuleAdd = new Permission();
		permModuleAdd.set(Permission.NAME, "模块新增权限");
		permModuleAdd.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-MENU:ADD-MOD");
		permModuleAdd.set(Permission.URL, "/system/admin/menu/add?type=0");
		permModuleAdd.set(Permission.TYPE, "3");
		permModuleAdd.set(Permission.AVAILABLE, "1");
		permModuleAdd.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permModuleAdd.getStr(Permission.PK_ID), moduleAdd.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permModuleAdd.getStr(Permission.PK_ID));
		
		Permission permModuleEdit = new Permission();
		permModuleEdit.set(Permission.NAME, "模块编辑权限");
		permModuleEdit.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-MENU:EDIT-MOD");
		permModuleEdit.set(Permission.URL, "/system/admin/menu/edit?type=0");
		permModuleEdit.set(Permission.TYPE, "3");
		permModuleEdit.set(Permission.AVAILABLE, "1");
		permModuleEdit.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permModuleEdit.getStr(Permission.PK_ID), moduleEdit.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permModuleEdit.getStr(Permission.PK_ID));
		
		Permission permModuleDel = new Permission();
		permModuleDel.set(Permission.NAME, "模块删除权限");
		permModuleDel.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-MENU:DELETES-MOD");
		permModuleDel.set(Permission.URL, "/system/admin/menu/deletes?type=0");
		permModuleDel.set(Permission.TYPE, "3");
		permModuleDel.set(Permission.AVAILABLE, "1");
		permModuleDel.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permModuleDel.getStr(Permission.PK_ID), moduleDel.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permModuleDel.getStr(Permission.PK_ID));
		
		Permission permMenuAdd = new Permission();
		permMenuAdd.set(Permission.NAME, "菜单新增权限");
		permMenuAdd.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-MENU:ADD");
		permMenuAdd.set(Permission.URL, "/system/admin/menu/add");
		permMenuAdd.set(Permission.TYPE, "3");
		permMenuAdd.set(Permission.AVAILABLE, "1");
		permMenuAdd.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permMenuAdd.getStr(Permission.PK_ID), menuAdd.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permMenuAdd.getStr(Permission.PK_ID));
		
		Permission permMenuEdit = new Permission();
		permMenuEdit.set(Permission.NAME, "菜单编辑权限");
		permMenuEdit.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-MENU:EDIT");
		permMenuEdit.set(Permission.URL, "/system/admin/menu/edit");
		permMenuEdit.set(Permission.TYPE, "3");
		permMenuEdit.set(Permission.AVAILABLE, "1");
		permMenuEdit.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permMenuEdit.getStr(Permission.PK_ID), menuEdit.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permMenuEdit.getStr(Permission.PK_ID));
		
		Permission permMenuDel = new Permission();
		permMenuDel.set(Permission.NAME, "菜单删除权限");
		permMenuDel.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-MENU:DELETES");
		permMenuDel.set(Permission.URL, "/system/admin/menu/deletes");
		permMenuDel.set(Permission.TYPE, "3");
		permMenuDel.set(Permission.AVAILABLE, "1");
		permMenuDel.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permMenuDel.getStr(Permission.PK_ID), menuDel.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permMenuDel.getStr(Permission.PK_ID));
		
		Permission permMenuFunc = new Permission();
		permMenuFunc.set(Permission.NAME, "功能管理权限");
		permMenuFunc.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-FUNC");
		permMenuFunc.set(Permission.URL, "/system/admin/function/**");
		permMenuFunc.set(Permission.TYPE, "2");
		permMenuFunc.set(Permission.AVAILABLE, "1");
		permMenuFunc.save();
		Db.update("insert into sys_permission_menu(permissionid, menuid) values(?,?)", permMenuFunc.getStr(Permission.PK_ID), menuFunc.getStr(Menu.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permMenuFunc.getStr(Permission.PK_ID));

		Permission permFuncAdd = new Permission();
		permFuncAdd.set(Permission.NAME, "功能新增权限");
		permFuncAdd.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-FUNC:ADD");
		permFuncAdd.set(Permission.URL, "/system/admin/function/add");
		permFuncAdd.set(Permission.TYPE, "3");
		permFuncAdd.set(Permission.AVAILABLE, "1");
		permFuncAdd.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permFuncAdd.getStr(Permission.PK_ID), funcAdd.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permFuncAdd.getStr(Permission.PK_ID));
		
		Permission permFuncEdit = new Permission();
		permFuncEdit.set(Permission.NAME, "功能编辑权限");
		permFuncEdit.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-FUNC:EDIT");
		permFuncEdit.set(Permission.URL, "/system/admin/function/edit");
		permFuncEdit.set(Permission.TYPE, "3");
		permFuncEdit.set(Permission.AVAILABLE, "1");
		permFuncEdit.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permFuncEdit.getStr(Permission.PK_ID), funcEdit.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permFuncEdit.getStr(Permission.PK_ID));
		
		Permission permFuncDel = new Permission();
		permFuncDel.set(Permission.NAME, "功能删除权限");
		permFuncDel.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-FUNC:DELETES");
		permFuncDel.set(Permission.URL, "/system/admin/function/deletes");
		permFuncDel.set(Permission.TYPE, "3");
		permFuncDel.set(Permission.AVAILABLE, "1");
		permFuncDel.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permFuncDel.getStr(Permission.PK_ID), funcDel.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permFuncDel.getStr(Permission.PK_ID));
		
		Permission permMenuArea = new Permission();
		permMenuArea.set(Permission.NAME, "区域管理权限");
		permMenuArea.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-AREA");
		permMenuArea.set(Permission.URL, "/system/admin/area/**");
		permMenuArea.set(Permission.TYPE, "2");
		permMenuArea.set(Permission.AVAILABLE, "1");
		permMenuArea.save();
		Db.update("insert into sys_permission_menu(permissionid, menuid) values(?,?)", permMenuArea.getStr(Permission.PK_ID), menuArea.getStr(Menu.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permMenuArea.getStr(Permission.PK_ID));

		//mengde-area		
		Permission permAreaAdd = new Permission();
		permAreaAdd.set(Permission.NAME, "区域新增权限");
		permAreaAdd.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-AREA:ADD");
		permAreaAdd.set(Permission.URL, "/system/admin/area/add");
		permAreaAdd.set(Permission.TYPE, "3");
		permAreaAdd.set(Permission.AVAILABLE, "1");
		permAreaAdd.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permAreaAdd.getStr(Permission.PK_ID), areaAdd.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permAreaAdd.getStr(Permission.PK_ID));
				
		Permission permAreaEdit = new Permission();
		permAreaEdit.set(Permission.NAME, "区域编辑权限");
		permAreaEdit.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-AREA:EDIT");
		permAreaEdit.set(Permission.URL, "/system/admin/area/edit");
		permAreaEdit.set(Permission.TYPE, "3");
		permAreaEdit.set(Permission.AVAILABLE, "1");
		permAreaEdit.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permAreaEdit.getStr(Permission.PK_ID), areaEdit.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permAreaEdit.getStr(Permission.PK_ID));
				
		Permission permAreaDel = new Permission();
		permAreaDel.set(Permission.NAME, "区域删除权限");
		permAreaDel.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-AREA:DELETES");
		permAreaDel.set(Permission.URL, "/system/admin/area/deletes");
		permAreaDel.set(Permission.TYPE, "3");
		permAreaDel.set(Permission.AVAILABLE, "1");
		permAreaDel.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permAreaDel.getStr(Permission.PK_ID), areaDel.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permAreaDel.getStr(Permission.PK_ID));
		
		Permission permMenuOrg = new Permission();
		permMenuOrg.set(Permission.NAME, "机构管理权限");
		permMenuOrg.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-ORG");
		permMenuOrg.set(Permission.URL, "/system/admin/org/**");
		permMenuOrg.set(Permission.TYPE, "2");
		permMenuOrg.set(Permission.AVAILABLE, "1");
		permMenuOrg.save();
		Db.update("insert into sys_permission_menu(permissionid, menuid) values(?,?)", permMenuOrg.getStr(Permission.PK_ID), menuOrg.getStr(Menu.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permMenuOrg.getStr(Permission.PK_ID));
		
		//mengde-org		
		Permission permOrgAdd = new Permission();
		permOrgAdd.set(Permission.NAME, "机构新增权限");
		permOrgAdd.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-ORG:ADD");
		permOrgAdd.set(Permission.URL, "/system/admin/org/add");
		permOrgAdd.set(Permission.TYPE, "3");
		permOrgAdd.set(Permission.AVAILABLE, "1");
		permOrgAdd.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permOrgAdd.getStr(Permission.PK_ID), orgAdd.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permOrgAdd.getStr(Permission.PK_ID));
						
		Permission permOrgEdit = new Permission();
		permOrgEdit.set(Permission.NAME, "机构编辑权限");
		permOrgEdit.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-ORG:EDIT");
		permOrgEdit.set(Permission.URL, "/system/admin/org/edit");
		permOrgEdit.set(Permission.TYPE, "3");
		permOrgEdit.set(Permission.AVAILABLE, "1");
		permOrgEdit.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permOrgEdit.getStr(Permission.PK_ID), orgEdit.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permOrgEdit.getStr(Permission.PK_ID));
				
		Permission permOrgDel = new Permission();
		permOrgDel.set(Permission.NAME, "机构删除权限");
		permOrgDel.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-ORG:DELETES");
		permOrgDel.set(Permission.URL, "/system/admin/org/deletes");
		permOrgDel.set(Permission.TYPE, "3");
		permOrgDel.set(Permission.AVAILABLE, "1");
		permOrgDel.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permOrgDel.getStr(Permission.PK_ID), orgDel.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permOrgDel.getStr(Permission.PK_ID));
		
		Permission permMenuGroup = new Permission();
		permMenuGroup.set(Permission.NAME, "用户组管理权限");
		permMenuGroup.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-GROUP");
		permMenuGroup.set(Permission.URL, "/system/admin/group/**");
		permMenuGroup.set(Permission.TYPE, "2");
		permMenuGroup.set(Permission.AVAILABLE, "1");
		permMenuGroup.save();
		Db.update("insert into sys_permission_menu(permissionid, menuid) values(?,?)", permMenuGroup.getStr(Permission.PK_ID), menuGroup.getStr(Menu.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permMenuGroup.getStr(Permission.PK_ID));
		
		//mengde-group		
		Permission permGroupAdd = new Permission();
		permGroupAdd.set(Permission.NAME, "用户组新增权限");
		permGroupAdd.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-GROUP:ADD");
		permGroupAdd.set(Permission.URL, "/system/admin/group/add");
		permGroupAdd.set(Permission.TYPE, "3");
		permGroupAdd.set(Permission.AVAILABLE, "1");
		permGroupAdd.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permGroupAdd.getStr(Permission.PK_ID), groupAdd.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permGroupAdd.getStr(Permission.PK_ID));
				
		Permission permGroupEdit = new Permission();
		permGroupEdit.set(Permission.NAME, "用户组编辑权限");
		permGroupEdit.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-GROUP:EDIT");
		permGroupEdit.set(Permission.URL, "/system/admin/group/edit");
		permGroupEdit.set(Permission.TYPE, "3");
		permGroupEdit.set(Permission.AVAILABLE, "1");
		permGroupEdit.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permGroupEdit.getStr(Permission.PK_ID), groupEdit.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permGroupEdit.getStr(Permission.PK_ID));
		
		Permission permGroupDel = new Permission();
		permGroupDel.set(Permission.NAME, "用户组删除权限");
		permGroupDel.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-GROUP:DELETES");
		permGroupDel.set(Permission.URL, "/system/admin/group/deletes");
		permGroupDel.set(Permission.TYPE, "3");
		permGroupDel.set(Permission.AVAILABLE, "1");
		permGroupDel.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permGroupDel.getStr(Permission.PK_ID), groupDel.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permGroupDel.getStr(Permission.PK_ID));
				
		Permission permGroupAlloc = new Permission();
		permGroupAlloc.set(Permission.NAME, "分配角色权限");
		permGroupAlloc.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-GROUP:ALLOC");
		permGroupAlloc.set(Permission.URL, "/system/admin/group/alloc");
		permGroupAlloc.set(Permission.TYPE, "3");
		permGroupAlloc.set(Permission.AVAILABLE, "1");
		permGroupAlloc.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permGroupAlloc.getStr(Permission.PK_ID), groupAlloc.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permGroupAlloc.getStr(Permission.PK_ID));
		
		Permission permMenuAccount = new Permission();
		permMenuAccount.set(Permission.NAME, "用户管理权限");
		permMenuAccount.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-USER");
		permMenuAccount.set(Permission.URL, "/system/admin/account/**");
		permMenuAccount.set(Permission.TYPE, "2");
		permMenuAccount.set(Permission.AVAILABLE, "1");
		permMenuAccount.save();
		Db.update("insert into sys_permission_menu(permissionid, menuid) values(?,?)", permMenuAccount.getStr(Permission.PK_ID), menuAccount.getStr(Menu.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permMenuAccount.getStr(Permission.PK_ID));

		//mengde-account		
		Permission permAccountAdd = new Permission();
		permAccountAdd.set(Permission.NAME, "账户新增权限");
		permAccountAdd.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-USER:ADD");
		permAccountAdd.set(Permission.URL, "/system/admin/account/add");
		permAccountAdd.set(Permission.TYPE, "3");
		permAccountAdd.set(Permission.AVAILABLE, "1");
		permAccountAdd.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permAccountAdd.getStr(Permission.PK_ID), accountAdd.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permAccountAdd.getStr(Permission.PK_ID));
		
		Permission permAccountEdit = new Permission();
		permAccountEdit.set(Permission.NAME, "账户编辑权限");
		permAccountEdit.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-USER:EDIT");
		permAccountEdit.set(Permission.URL, "/system/admin/account/edit");
		permAccountEdit.set(Permission.TYPE, "3");
		permAccountEdit.set(Permission.AVAILABLE, "1");
		permAccountEdit.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permAccountEdit.getStr(Permission.PK_ID), accountEdit.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permAccountEdit.getStr(Permission.PK_ID));
		
		Permission permAccountDel = new Permission();
		permAccountDel.set(Permission.NAME, "账户删除权限");
		permAccountDel.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-USER:DELETES");
		permAccountDel.set(Permission.URL, "/system/admin/account/deletes");
		permAccountDel.set(Permission.TYPE, "3");
		permAccountDel.set(Permission.AVAILABLE, "1");
		permAccountDel.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permAccountDel.getStr(Permission.PK_ID), accountDel.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permAccountDel.getStr(Permission.PK_ID));
		
		Permission permAccountAlloc = new Permission();
		permAccountAlloc.set(Permission.NAME, "分配用户组权限");
		permAccountAlloc.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-USER:ALLOC");
		permAccountAlloc.set(Permission.URL, "/system/admin/account/alloc");
		permAccountAlloc.set(Permission.TYPE, "3");
		permAccountAlloc.set(Permission.AVAILABLE, "1");
		permAccountAlloc.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permAccountAlloc.getStr(Permission.PK_ID), accountAlloc.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permAccountAlloc.getStr(Permission.PK_ID));
		
		Permission permMenuRole = new Permission();
		permMenuRole.set(Permission.NAME, "角色管理权限");
		permMenuRole.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-ROLE");
		permMenuRole.set(Permission.URL, "/system/admin/role/**");
		permMenuRole.set(Permission.TYPE, "2");
		permMenuRole.set(Permission.AVAILABLE, "1");
		permMenuRole.save();
		Db.update("insert into sys_permission_menu(permissionid, menuid) values(?,?)", permMenuRole.getStr(Permission.PK_ID), menuRole.getStr(Menu.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permMenuRole.getStr(Permission.PK_ID));
		
		//mengde-role		
		Permission permRoleAdd = new Permission();
		permRoleAdd.set(Permission.NAME, "角色新增权限");
		permRoleAdd.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-ROLE:ADD");
		permRoleAdd.set(Permission.URL, "/system/admin/role/add");
		permRoleAdd.set(Permission.TYPE, "3");
		permRoleAdd.set(Permission.AVAILABLE, "1");
		permRoleAdd.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permRoleAdd.getStr(Permission.PK_ID), roleAdd.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permRoleAdd.getStr(Permission.PK_ID));
						
		Permission permRoleEdit = new Permission();
		permRoleEdit.set(Permission.NAME, "角色编辑权限");
		permRoleEdit.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-ROLE:EDIT");
		permRoleEdit.set(Permission.URL, "/system/admin/role/edit");
		permRoleEdit.set(Permission.TYPE, "3");
		permRoleEdit.set(Permission.AVAILABLE, "1");
		permRoleEdit.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permRoleEdit.getStr(Permission.PK_ID), roleEdit.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permRoleEdit.getStr(Permission.PK_ID));
				
		Permission permRoleDel = new Permission();
		permRoleDel.set(Permission.NAME, "角色删除权限");
		permRoleDel.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-ROLE:DELETES");
		permRoleDel.set(Permission.URL, "/system/admin/role/deletes");
		permRoleDel.set(Permission.TYPE, "3");
		permRoleDel.set(Permission.AVAILABLE, "1");
		permRoleDel.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permRoleDel.getStr(Permission.PK_ID), roleDel.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permRoleDel.getStr(Permission.PK_ID));
		
		Permission permRoleAlloc = new Permission();
		permRoleAlloc.set(Permission.NAME, "分配权限权限");
		permRoleAlloc.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-ROLE:ALLOC");
		permRoleAlloc.set(Permission.URL, "/system/admin/role/alloc");
		permRoleAlloc.set(Permission.TYPE, "3");
		permRoleAlloc.set(Permission.AVAILABLE, "1");
		permRoleAlloc.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permRoleAlloc.getStr(Permission.PK_ID), roleAlloc.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permRoleAlloc.getStr(Permission.PK_ID));
		
		Permission permMenuPerm = new Permission();
		permMenuPerm.set(Permission.NAME, "权限管理权限");
		permMenuPerm.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-PERM");
		permMenuPerm.set(Permission.URL, "/system/admin/permission/**");
		permMenuPerm.set(Permission.TYPE, "2");
		permMenuPerm.set(Permission.AVAILABLE, "1");
		permMenuPerm.save();
		Db.update("insert into sys_permission_menu(permissionid, menuid) values(?,?)", permMenuPerm.getStr(Permission.PK_ID), menuPerm.getStr(Menu.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permMenuPerm.getStr(Permission.PK_ID));
				
		//mengde-perm-platform		
		Permission permPermPlatformAdd = new Permission();
		permPermPlatformAdd.set(Permission.NAME, "平台权限新增权限");
		permPermPlatformAdd.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-PERM:ADD-PLAT");
		permPermPlatformAdd.set(Permission.URL, "/system/admin/permission/add?type=0");
		permPermPlatformAdd.set(Permission.TYPE, "3");
		permPermPlatformAdd.set(Permission.AVAILABLE, "1");
		permPermPlatformAdd.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permPermPlatformAdd.getStr(Permission.PK_ID), permPlatAdd.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permPermPlatformAdd.getStr(Permission.PK_ID));
				
		Permission permPermPlatformEdit = new Permission();
		permPermPlatformEdit.set(Permission.NAME, "平台权限编辑权限");
		permPermPlatformEdit.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-PERM:EDIT-PLAT");
		permPermPlatformEdit.set(Permission.URL, "/system/admin/permission/edit?type=0");
		permPermPlatformEdit.set(Permission.TYPE, "3");
		permPermPlatformEdit.set(Permission.AVAILABLE, "1");
		permPermPlatformEdit.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permPermPlatformEdit.getStr(Permission.PK_ID), permPlatEdit.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permPermPlatformEdit.getStr(Permission.PK_ID));
				
		Permission permPermPlatformDel = new Permission();
		permPermPlatformDel.set(Permission.NAME, "平台权限删除权限");
		permPermPlatformDel.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-PERM:DELETES-PLAT");
		permPermPlatformDel.set(Permission.URL, "/system/admin/permission/deletes?type=0");
		permPermPlatformDel.set(Permission.TYPE, "3");
		permPermPlatformDel.set(Permission.AVAILABLE, "1");
		permPermPlatformDel.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permPermPlatformDel.getStr(Permission.PK_ID), permPlatDel.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permPermPlatformDel.getStr(Permission.PK_ID));

		//mengde-perm-module		
		Permission permPermModuleAdd = new Permission();
		permPermModuleAdd.set(Permission.NAME, "模块权限新增权限");
		permPermModuleAdd.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-PERM:ADD-MOD");
		permPermModuleAdd.set(Permission.URL, "/system/admin/permission/add?type=1");
		permPermModuleAdd.set(Permission.TYPE, "3");
		permPermModuleAdd.set(Permission.AVAILABLE, "1");
		permPermModuleAdd.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permPermModuleAdd.getStr(Permission.PK_ID), permModAdd.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permPermModuleAdd.getStr(Permission.PK_ID));
				
		Permission permPermModuleEdit = new Permission();
		permPermModuleEdit.set(Permission.NAME, "模块权限编辑权限");
		permPermModuleEdit.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-PERM:EDIT-MOD");
		permPermModuleEdit.set(Permission.URL, "/system/admin/permission/edit?type=1");
		permPermModuleEdit.set(Permission.TYPE, "3");
		permPermModuleEdit.set(Permission.AVAILABLE, "1");
		permPermModuleEdit.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permPermModuleEdit.getStr(Permission.PK_ID), permModEdit.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permPermModuleEdit.getStr(Permission.PK_ID));
				
		Permission permPermModuleDel = new Permission();
		permPermModuleDel.set(Permission.NAME, "模块权限删除权限");
		permPermModuleDel.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-PERM:DELETES-MOD");
		permPermModuleDel.set(Permission.URL, "/system/admin/permission/deletes?type=1");
		permPermModuleDel.set(Permission.TYPE, "3");
		permPermModuleDel.set(Permission.AVAILABLE, "1");
		permPermModuleDel.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permPermModuleDel.getStr(Permission.PK_ID), permModDel.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permPermModuleDel.getStr(Permission.PK_ID));
		
		//mengde-perm		
		Permission permPermAdd = new Permission();
		permPermAdd.set(Permission.NAME, "菜单权限新增权限");
		permPermAdd.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-PERM:ADD-MENU");
		permPermAdd.set(Permission.URL, "/system/admin/permission/add?type=2");
		permPermAdd.set(Permission.TYPE, "3");
		permPermAdd.set(Permission.AVAILABLE, "1");
		permPermAdd.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permPermAdd.getStr(Permission.PK_ID), permAdd.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permPermAdd.getStr(Permission.PK_ID));
				
		Permission permPermEdit = new Permission();
		permPermEdit.set(Permission.NAME, "菜单权限编辑权限");
		permPermEdit.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-PERM:EDIT-MENU");
		permPermEdit.set(Permission.URL, "/system/admin/permission/edit?type=2");
		permPermEdit.set(Permission.TYPE, "3");
		permPermEdit.set(Permission.AVAILABLE, "1");
		permPermEdit.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permPermEdit.getStr(Permission.PK_ID), permEdit.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permPermEdit.getStr(Permission.PK_ID));
				
		Permission permPermDel = new Permission();
		permPermDel.set(Permission.NAME, "菜单权限删除权限");
		permPermDel.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-PERM:DELETES-MENU");
		permPermDel.set(Permission.URL, "/system/admin/permission/deletes?type=2");
		permPermDel.set(Permission.TYPE, "3");
		permPermDel.set(Permission.AVAILABLE, "1");
		permPermDel.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permPermDel.getStr(Permission.PK_ID), permDel.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permPermDel.getStr(Permission.PK_ID));

		//mengde-perm-func		
		Permission permPermFuncAdd = new Permission();
		permPermFuncAdd.set(Permission.NAME, "功能权限新增权限");
		permPermFuncAdd.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-PERM:ADD-FUNC");
		permPermFuncAdd.set(Permission.URL, "/system/admin/permission/add?type=3");
		permPermFuncAdd.set(Permission.TYPE, "3");
		permPermFuncAdd.set(Permission.AVAILABLE, "1");
		permPermFuncAdd.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permPermFuncAdd.getStr(Permission.PK_ID), permfuncAdd.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permPermFuncAdd.getStr(Permission.PK_ID));
				
		Permission permPermFuncEdit = new Permission();
		permPermFuncEdit.set(Permission.NAME, "功能权限编辑权限");
		permPermFuncEdit.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-PERM:EDIT-FUNC");
		permPermFuncEdit.set(Permission.URL, "/system/admin/permission/edit?type=3");
		permPermFuncEdit.set(Permission.TYPE, "3");
		permPermFuncEdit.set(Permission.AVAILABLE, "1");
		permPermFuncEdit.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permPermFuncEdit.getStr(Permission.PK_ID), permfuncEdit.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permPermFuncEdit.getStr(Permission.PK_ID));
				
		Permission permPermFuncDel = new Permission();
		permPermFuncDel.set(Permission.NAME, "功能权限删除权限");
		permPermFuncDel.set(Permission.CODE, "P-BASE:MOD-SYSTEM:M-PERM:DELETES-FUNC");
		permPermFuncDel.set(Permission.URL, "/system/admin/permission/deletes?type=3");
		permPermFuncDel.set(Permission.TYPE, "3");
		permPermFuncDel.set(Permission.AVAILABLE, "1");
		permPermFuncDel.save();
		Db.update("insert into sys_permission_function(permissionid, functionid) values(?,?)", permPermFuncDel.getStr(Permission.PK_ID), permfuncDel.getStr(Function.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permPermFuncDel.getStr(Permission.PK_ID));
			
		Permission permModuleUCenter = new Permission();
		permModuleUCenter.set(Permission.NAME, "用户中心权限");
		permModuleUCenter.set(Permission.CODE, "P-BASE:MOD-UCENTER");
		permModuleUCenter.set(Permission.URL, "/system/ucenter/**");
		permModuleUCenter.set(Permission.TYPE, "1");
		permModuleUCenter.set(Permission.AVAILABLE, "1");
		permModuleUCenter.save();
		Db.update("insert into sys_permission_menu(permissionid, menuid) values(?,?)", permModuleUCenter.getStr(Permission.PK_ID), moduleUCenter.getStr(Menu.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permModuleUCenter.getStr(Permission.PK_ID));
		
		Permission permMenuUAccount = new Permission();
		permMenuUAccount.set(Permission.NAME, "个人账号权限");
		permMenuUAccount.set(Permission.CODE, "P-BASE:MOD-UCENTER:M-ACCOUNT");
		permMenuUAccount.set(Permission.URL, "/system/ucenter/account/**");
		permMenuUAccount.set(Permission.TYPE, "2");
		permMenuUAccount.set(Permission.AVAILABLE, "1");
		permMenuUAccount.save();
		Db.update("insert into sys_permission_menu(permissionid, menuid) values(?,?)", permMenuUAccount.getStr(Permission.PK_ID), menuUAccount.getStr(Menu.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permMenuUAccount.getStr(Permission.PK_ID));
				
		Permission permMenuUUser = new Permission();
		permMenuUUser.set(Permission.NAME, "个人资料权限");
		permMenuUUser.set(Permission.CODE, "P-BASE:MOD-UCENTER:M-UUSER");
		permMenuUUser.set(Permission.URL, "/system/ucenter/user/**");
		permMenuUUser.set(Permission.TYPE, "2");
		permMenuUUser.set(Permission.AVAILABLE, "1");
		permMenuUUser.save();
		Db.update("insert into sys_permission_menu(permissionid, menuid) values(?,?)", permMenuUUser.getStr(Permission.PK_ID), menuUUser.getStr(Menu.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permMenuUUser.getStr(Permission.PK_ID));
		
		Permission permMenuUPwd = new Permission();
		permMenuUPwd.set(Permission.NAME, "密码修改权限");
		permMenuUPwd.set(Permission.CODE, "P-BASE:MOD-UCENTER:M-UPWD");
		permMenuUPwd.set(Permission.URL, "/system/ucenter/pwd/**");
		permMenuUPwd.set(Permission.TYPE, "2");
		permMenuUPwd.set(Permission.AVAILABLE, "1");
		permMenuUPwd.save();
		Db.update("insert into sys_permission_menu(permissionid, menuid) values(?,?)", permMenuUPwd.getStr(Permission.PK_ID), menuUPwd.getStr(Menu.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permMenuUPwd.getStr(Permission.PK_ID));
		
		Permission permModuleMonitor = new Permission();
		permModuleMonitor.set(Permission.NAME, "系统监控权限");
		permModuleMonitor.set(Permission.CODE, "P-BASE:MOD-MONITOR");
		permModuleMonitor.set(Permission.URL, "/system/monitor/**");
		permModuleMonitor.set(Permission.TYPE, "1");
		permModuleMonitor.set(Permission.AVAILABLE, "1");
		permModuleMonitor.save();
		Db.update("insert into sys_permission_menu(permissionid, menuid) values(?,?)", permModuleMonitor.getStr(Permission.PK_ID), moduleMonitor.getStr(Menu.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permModuleMonitor.getStr(Permission.PK_ID));
		
		Permission permMenuDruid = new Permission();
		permMenuDruid.set(Permission.NAME, "数据监控权限");
		permMenuDruid.set(Permission.CODE, "P-BASE:MOD-MONITOR:M-DRUID");
		permMenuDruid.set(Permission.URL, "/system/monitor/druid/**");
		permMenuDruid.set(Permission.TYPE, "2");
		permMenuDruid.set(Permission.AVAILABLE, "1");
		permMenuDruid.save();
		Db.update("insert into sys_permission_menu(permissionid, menuid) values(?,?)", permMenuDruid.getStr(Permission.PK_ID), menuDruid.getStr(Menu.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permMenuDruid.getStr(Permission.PK_ID));
				
		Permission permMenuLog = new Permission();
		permMenuLog.set(Permission.NAME, "日志监控权限");
		permMenuLog.set(Permission.CODE, "P-BASE:MOD-MONITOR:M-LOG");
		permMenuLog.set(Permission.URL, "/system/monitor/log/**");
		permMenuLog.set(Permission.TYPE, "2");
		permMenuLog.set(Permission.AVAILABLE, "1");
		permMenuLog.save();
		Db.update("insert into sys_permission_menu(permissionid, menuid) values(?,?)", permMenuLog.getStr(Permission.PK_ID), menuLog.getStr(Menu.PK_ID));
		Db.update("insert into sys_role_permission(roleid, permissionid) values(?, ?)", roleSuper.getStr(Role.PK_ID), permMenuLog.getStr(Permission.PK_ID));
		
	}

}
